﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TA.DotNetUtils
{
	public static class _DateTimeExtensions
	{
		public static DateTime GetNext(this DateTime This, DayOfWeek dayOfWeek)
		{
			return This.AddDays((7 + (int)dayOfWeek - (int)This.DayOfWeek) % 7).Date;
		}
		public static DateTime GetPrevious(this DateTime This, DayOfWeek dayOfWeek)
		{
			return This.AddDays(((int)dayOfWeek - (int)This.DayOfWeek - 7) % 7).Date;
		}
	}
}
